﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <Style x:Key="CalanderDayButtonStyle" TargetType="CalendarDayButton">
        <Setter Property="MinWidth" Value="45" />
        <Setter Property="MinHeight" Value="45" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CalendarDayButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation 
                                                    Storyboard.TargetName="HighlightBackground"
                                                    Storyboard.TargetProperty="Opacity" 
                                                    To="0.5" 
                                                    Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation 
                                                    Storyboard.TargetName="HighlightBackground"
                                                    Storyboard.TargetProperty="Opacity"
                                                    To="0.5"
                                                    Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation 
                                                    Storyboard.TargetName="HighlightBackground"
                                                    Storyboard.TargetProperty="Opacity"
                                                    To="0"
                                                    Duration="0" />
                                        <DoubleAnimation 
                                                    Storyboard.TargetName="NormalText"
                                                    Storyboard.TargetProperty="Opacity"
                                                    To=".35"
                                                    Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Unselected" />
                                <VisualState Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation 
                                                    Storyboard.TargetName="SelectedBackground"
                                                    Storyboard.TargetProperty="Opacity"
                                                    To=".75"
                                                    Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="CalendarButtonFocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DayButtonFocusVisual"
                                                 Storyboard.TargetProperty="Visibility"
                                                 Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DayButtonFocusVisual"
                                                 Storyboard.TargetProperty="Visibility"
                                                 Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Active" />
                                <VisualState Name="Inactive">
                                    <Storyboard>
                                        <ColorAnimation 
                                                    Duration="0"
                                                    Storyboard.TargetName="NormalText"
                                                    Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
                                                    To="#FF777777" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="DayStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="RegularDay" />
                                <VisualState Name="Today">
                                    <Storyboard>
                                        <DoubleAnimation 
                                                    Storyboard.TargetName="TodayBackground"
                                                    Storyboard.TargetProperty="Opacity"
                                                    To="1"
                                                    Duration="0" />
                                        <ColorAnimation Duration="0"
                                                    Storyboard.TargetName="NormalText"
                                                    Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
                                                    To="#FFFFFFFF" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="BlackoutDayStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="NormalDay" />
                                <VisualState Name="BlackoutDay">
                                    <Storyboard>
                                        <DoubleAnimation 
                                                    Duration="0"
                                                    Storyboard.TargetName="Blackout"
                                                    Storyboard.TargetProperty="Opacity"
                                                    To=".2" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="TodayBackground"
                                    RadiusX="1"
                                    RadiusY="1"
                                    Opacity="0">
                            <Rectangle.Fill>
                                <SolidColorBrush Color="#44000000" />
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="SelectedBackground"
                                    RadiusX="1"
                                    RadiusY="1"
                                    Opacity="0"
                                    Fill="{DynamicResource ImageHoverBrush}"/>
                        <Border 
                                    Background="{TemplateBinding Background}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    BorderBrush="{TemplateBinding BorderBrush}" />
                        <Rectangle 
                                    x:Name="HighlightBackground"
                                    RadiusX="1"
                                    RadiusY="1"
                                    Opacity="0">
                            <Rectangle.Fill>
                                <SolidColorBrush Color="#11000000" />
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter 
                                    x:Name="NormalText"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Margin="5,1,5,1"
                                    TextElement.Foreground="{DynamicResource Brush.Text}">
                        </ContentPresenter>
                        <Path x:Name="Blackout"
                                    Opacity="0"
                                    Margin="3"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    RenderTransformOrigin="0.5,0.5"
                                    Fill="#FF000000"
                                    Stretch="Fill"
                                    Data="M8.1772461,11.029181 L10.433105,
                                      11.029181 L11.700684,12.801641 L12.973633,
                                      11.029181 L15.191895,11.029181 L12.844727,
                                      13.999395 L15.21875,17.060919 L12.962891,
                                      17.060919 L11.673828,15.256231 L10.352539,
                                      17.060919 L8.1396484,17.060919 L10.519043,
                                      14.042364 z" />
                        <Rectangle 
                                    x:Name="DayButtonFocusVisual"
                                    Visibility="Collapsed"
                                    IsHitTestVisible="false"
                                    RadiusX="1"
                                    RadiusY="1">
                        </Rectangle>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="StyleCalanderButton" TargetType="{x:Type CalendarButton}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Height" Value="60"></Setter>
        <Setter Property="Width" Value="60"></Setter>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FontSize" Value="18" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#11000000"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="#33000000"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="{x:Type Button}">
        <Grid Cursor="Hand">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation 
                                        Duration="0" 
                                        Storyboard.TargetName="path" 
                                        Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" 
                                        To="#55000000" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid  Background="Transparent">
                <Ellipse Width="20" Height="20" Fill="#22000000"/>
                <Path 
                            x:Name="path"
                            Margin="0,0,3,0" 
                            Stretch="Fill"
                            Height="10"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Width="6"
                            Data="M288.75,232.25 L288.75,240.625 L283,236.625 z">
                    <Path.Fill>
                        <SolidColorBrush Color="#22000000" />
                    </Path.Fill>
                </Path>
            </Grid>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="NextButtonTemplate" TargetType="{x:Type Button}">
        <Grid Cursor="Hand">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation 
                                        Duration="0"
                                        To="#55000000"
                                        Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
                                        Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation 
                                        Duration="0"
                                        To=".5"
                                        Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
                                        Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid Background="Transparent">
                <Ellipse Width="20" Height="20" Fill="#22000000"/>
                <Path x:Name="path"
                            Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
                            Height="10"
                            Margin="3,0,0,0"
                            Stretch="Fill"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Width="6">
                    <Path.Fill>
                        <SolidColorBrush Color="#22000000" />
                    </Path.Fill>
                </Path>
            </Grid>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="{x:Type Button}">
        <Grid Cursor="Hand">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0"
                                     To=".5"
                                     Storyboard.TargetProperty="Opacity"
                                     Storyboard.TargetName="buttonContent" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <ContentPresenter x:Name="buttonContent"
                        Margin="3,7"
                        ContentTemplate="{TemplateBinding ContentTemplate}"
                        Content="{TemplateBinding Content}"
                        TextElement.Foreground="{DynamicResource Brush.Text}"
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="{x:Type CalendarItem}" TargetType="{x:Type CalendarItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CalendarItem}">
                    <ControlTemplate.Resources>
                        <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
                            <TextBlock Foreground="#FF333333"
                                        FontWeight="Bold"
                                        FontSize="9.5"
                                        FontFamily="Verdana"
                                        Margin="0,6,0,6"
                                        Text="{Binding}"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center" />
                        </DataTemplate>
                    </ControlTemplate.Resources>
                    <Grid x:Name="PART_Root">
                        <Grid.Resources>
                            <SolidColorBrush x:Key="DisabledColor" Color="#A5FFFFFF" />
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                    To="1"
                                                    Storyboard.TargetProperty="Opacity"
                                                    Storyboard.TargetName="PART_DisabledVisual" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Button x:Name="PART_PreviousButton"
                                            Template="{StaticResource PreviousButtonTemplate}"
                                            Focusable="False"
                                            HorizontalAlignment="Left"
                                            Grid.Column="0"
                                            Grid.Row="0"
                                            Height="20"
                                            Width="28" />
                                <Button x:Name="PART_HeaderButton"
                                            FontWeight="Bold"
                                            Focusable="False"
                                            FontSize="10.5"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center"
                                            Grid.Column="1"
                                            Grid.Row="0"
                                            Template="{StaticResource HeaderButtonTemplate}" />
                                <Button x:Name="PART_NextButton"
                                            Focusable="False"
                                            HorizontalAlignment="Right"
                                            Grid.Column="2"
                                            Grid.Row="0"
                                            Template="{StaticResource NextButtonTemplate}"
                                            Height="20"
                                            Width="28" />
                                <Grid x:Name="PART_MonthView"
                                            Visibility="Visible"
                                            Grid.ColumnSpan="3"
                                            Grid.Row="1"
                                            Margin="6,-1,6,6"
                                            HorizontalAlignment="Center">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                </Grid>
                                <Grid x:Name="PART_YearView"
                                            Visibility="Hidden"
                                            Grid.ColumnSpan="3"
                                            Grid.Row="1"
                                            HorizontalAlignment="Center"
                                            Margin="6,-3,7,6">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                </Grid>
                            </Grid>
                        </Border>
                        <Rectangle x:Name="PART_DisabledVisual"
                                     Fill="{StaticResource DisabledColor}"
                                     Opacity="0"
                                     RadiusY="2"
                                     RadiusX="2"
                                     Stretch="Fill"
                                     Stroke="{StaticResource DisabledColor}"
                                     StrokeThickness="1"
                                     Visibility="Collapsed" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="PART_DisabledVisual" Value="Visible" />
                        </Trigger>
                        <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
                            <Setter Property="Visibility" TargetName="PART_MonthView" Value="Hidden" />
                            <Setter Property="Visibility" TargetName="PART_YearView" Value="Visible" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
                            <Setter Property="Visibility" TargetName="PART_MonthView" Value="Hidden" />
                            <Setter Property="Visibility" TargetName="PART_YearView" Value="Visible" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Calendar}">
        <Setter Property="CalendarDayButtonStyle"  Value="{StaticResource CalanderDayButtonStyle}"></Setter>
        <Setter Property="CalendarButtonStyle"  Value="{StaticResource StyleCalanderButton}"></Setter>
        <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="MinHeight" Value="128"/>
        <Setter Property="MinWidth" Value="128"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Calendar}">
                    <Viewbox 
                        Height="{TemplateBinding Height}"
                        MinHeight="{TemplateBinding MinHeight}"
                        MinWidth="{TemplateBinding MinWidth}"
                        Width="{TemplateBinding Width}">
                        <CalendarItem x:Name="PART_CalendarItem" 
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            FontStretch="Expanded"  >
                        </CalendarItem>
                    </Viewbox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>